<?php

class Languages extends BaseLanguages
{
    public $valueDecode;
    
    protected function afterFind()
    {
        parent::afterFind();
        $this->valueDecode = json_decode($this->value);        
    }
    
    /**
     *
     * @param type $group frontend, backend, all
     * @param type $active
     * @return type Get Languages record
     */
    public static function getList($group = NULL, $active = NULL) {
        $criteria = new CDbCriteria;
        
//        $criteria->condition = '';
        if ($active !== NULL AND (int) $active == 0)
            $criteria->condition = letFunction::addWhere($criteria->condition, 'active = 0');
        elseif ($active !== NULL AND (int) $active == 1)
            $criteria->condition = letFunction::addWhere($criteria->condition, 'active > 0');
        
        $criteria->order = 'module ASC, keyword ASC';
        return self::model()->findAll($criteria);
    }

}